<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<c:set var="jpath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>用户列表</title>
		<meta name="keywords" content="Bootstrap模版,Bootstrap模版下载,Bootstrap教程,Bootstrap中文" />
		<meta name="description" content="站长素材提供Bootstrap模版,Bootstrap教程,Bootstrap中文翻译等相关Bootstrap插件下载" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<%@include file="css.jsp"%>
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/css/webuploader.css" />
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/style.css" />
	</head>

	<body>
<div class="page-content">
<div class="row">
					<div class="col-xs-12">
						<div class="table-responsive">
							<table id="sample-table-1" class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th class="center">
											<label>
												<input id="ch" type="checkbox" class="ace" value="全选" />
												<span class="lbl"></span>
											</label>
										</th>
										<th>附件名称</th>
										<th>上传时间</th>
										<th>操作</th>
										<th>附件下载</th>
									</tr>
								</thead>

								<tbody>
									
								</tbody>
							</table>
						</div><!-- /.table-responsive -->
					</div><!-- /span -->
									<div class="space-4"></div>
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"></label>
										<div class="form-group"> <div id="wrapper" class="col-sm-8" style="width: 700px;">
										        <div id="container">
										            <!--头部，相册选择和格式选择-->
										
										            <div id="uploader">
										                <div class="queueList">
										                    <div id="dndArea" class="placeholder">
										                        <div id="filePicker"></div>
										                        <p>或将照片拖到这里，单次最多可选300张</p>
										                    </div>
										                </div>
										                <div class="statusBar" style="display:none;">
										                    <div class="progress">
										                        <span class="text">0%</span>
										                        <span class="percentage"></span>
										                    </div><div class="info"></div>
										                    <div class="btns">
										                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
										                    </div>
										                </div>
										            </div>
										        </div>
										    </div>
										</div>
				</div><!-- /row -->
		
	</div><!-- /.page-content -->
<%@include file="js.jsp"%>
<script type="text/javascript" src="${jpath}/static/plugins/webuploader/dist/webuploader.js"></script>
<script type="text/javascript" src="${jpath}/static/plugins/webuploader/upload.js"></script>
<script type="text/javascript">
	function delMBtn(id){
		var delId=new Array();
		$("input[type='checkbox']").each(function(index) {
			if ($(this).is(':checked') == true) {
		  		delId[index] = $(this).val(); 
			} 
		});
		var str = delId.toString();
		$.post("${jpath}/user/deleteBatch",{uiCheck:str},function(data){
				var json = $.parseJSON(data);
				alert(json.resMsg);
				if(json.resMsg=="批量删除成功"){
					var hrefStr = "${jpath}/UserContent";
					location.href=hrefStr;
				};
			}
		);
	};
	function delBtn(id){
		$.post("${jpath}/user/delect",{id:id},
			function(data){
				var json = $.parseJSON(data);
				alert(json.resMsg);
				if(json.resMsg=="删除成功"){
					var hrefStr = "${jpath}/UserContent";
					location.href=hrefStr;
				};
			}
		);
	};
	function downBtn(){
		var name = $("#appname").val();
		var url = $("#url").val();
		var file = url+name;
		var hrefStr = "${jpath}/downById?fileurl="+file;
		location.href=hrefStr;
	};
	$(function(){
		//loadTbl(1,$("#xuhao").find("li[class='active']"));
		var colM=[{
			name:'id',
			cl:function(index,val){
				return '<label><input type="checkbox" name="check" class="ace" value="'+val+'"/><span class="lbl"><input type="hidden"></span></label>';
				}
			},{
				name:'appendixFileName'
			},{
				name:'uploadTimeToString'
			},{
				name:'appendixUrl',
				cl:function(index,val){
					return '<div class="btn-group"><button class="btn btn-xs btn-danger" onclick="delBtn(\''+val+'\')"><i class="icon-trash bigger-120"></i></button><input type="hidden" id="url" value="'+val+'"></div>';
				}
			},{
			name:'appendixName',
			cl:function(index,val){
				return '<div class="btn-group"><button class="btn btn-xs btn-info" onclick="downBtn()"><i bigger-120">下载附件</i></button><input type="hidden" id="appname" name="appname" value="'+val+'"></div>';
				}
			}];
		var pasrams={pageNum:1,pageSize:2};	
		$("#sample-table-1").loadTbl(colM,pasrams,"${jpath}/appendixFindByPage",true);
		 $("#ch").click(function(){
          //转化为JQ对象并调用prop方法获取属性
          //alert($(this).prop("checked"));
               //获取其他复选框，使用prop方式设置属性与全选框保持一致
         	 $("input[type='checkbox']").prop("checked",$(this).prop("checked"));  
          });
	});
</script>
</body>
</html>
